Pulse width modulated voltage measuring circuit and method

ABSTRACT

A voltage measuring circuit includes a rectifier to receive an alternating current (AC) voltage to be measured and to provide a rectified output; a comparator for comparing the rectified output and producing therefrom a square wave having a pulse width indicative of the rectified output exceeding a threshold; a calculation circuit for converting a measurement of the pulse width into a measurement of the voltage and optionally an opto-isolator interconnecting the comparator to the calculation circuit. The rectifier may provide operating power to the comparator and an input side of the opto-isolator, from the AC voltage signal being measured. The remainder of the measuring circuit may powered by a source isolated from the voltage to be measured.

CROSS-REFERENCE TO RELATED APPLICATIONS

The present application claims priority from U.S. Provisional Patent Application No. 61/577,303, filed Dec. 19, 2011 the contents of which are hereby incorporated by reference.

FIELD OF THE INVENTION

The present invention relates generally to electronic measurement, and more particularly to voltage measuring circuits, suitable for measuring root-mean square voltages and other metrics of a time varying voltages.

BACKGROUND OF THE INVENTION

Many practical applications require measuring the magnitude of an AC voltage signal.

For example, universal power supplies (UPS) often measure source voltages with great precision. Likewise alarm systems often monitor AC mains to sense power outages.

Typical techniques require the AC voltage signal to be sampled continuously. From the sampling, the zero crossing of the assessed may be assessed and a root-mean-square (RMS) voltage value may be calculated as the square root of the arithmetic mean of the squares of the sampled values. Alternatively, for known periodic waveforms, the peak value of the signal may be assessed, and an RMS voltage may be calculated—for example for a perfectly sinusoidal signal, the RMS voltage may be calculated as the peak voltage divided by the square root of two (√2). Yet other techniques involve rectifying the AC voltage signal and filtering the resulting rectified signal as a proxy for the amplitude of the AC voltage signal.

Typical measuring circuits include a voltage divider used to sample the AC voltage signal of interesting. However, isolating the measuring circuit from the remainder of the circuit proves to be costly, and is usually accomplished using an isolation transformer, or an analog to digital converter, powered by an isolated power source.

Accordingly, there is a need for a new AC voltage measurement circuit that may be more inexpensively isolated, and method.

SUMMARY OF THE INVENTION

Exemplary of an embodiment of the invention, a voltage measuring circuit includes a rectifier to receive an alternating current (AC) voltage to be measured and to provide a rectified output; a comparator for comparing the rectified output and producing therefrom a square wave having a pulse width indicative of the rectified output exceeding a threshold; a calculation circuit for converting a measurement of the pulse width into a measurement of the voltage and optionally an opto-isolator interconnecting the comparator to the calculation circuit. The rectifier may provide operating power to the comparator and an input side of the opto-isolator, from the AC voltage signal being measured. The remainder of the measuring circuit may powered by a source isolated from the voltage to be measured.

In accordance with an aspect of the present invention, there is provided method of measuring the magnitude of an AC voltage signal. The method comprises: rectifying the AC voltage signal to provide a rectified output; comparing the rectified output and producing therefrom a square wave having a pulse width indicative of the rectified output exceeding a threshold; converting a measurement of the pulse width into a measurement of the magnitude of the AC voltage signal.

Other aspects and features of the present invention will become apparent to those of ordinary skill in the art upon review of the following description of specific embodiments of the invention in conjunction with the accompanying figures.

BRIEF DESCRIPTION OF THE DRAWINGS

In the figures which illustrate by way of example only, embodiments of the present invention,

FIG. 1 is a graph of a sinusoidal wave form corresponding to an input voltage;

FIG. 2 is a block diagram of a voltage measuring circuit, exemplary of an embodiment of the present invention;

FIGS. 3A and 3B are block diagrams of possible calculation circuits used in the voltage measuring circuit of FIG. 2;

FIGS. 4A, 4B and 4C are graphs of waveforms formed by the measuring circuit of FIG. 2; and

FIG. 5 is a schematic diagram of a voltage measuring circuit, exemplary of an embodiment of the present invention.

DETAILED DESCRIPTION

FIG. 2 illustrates an exemplary voltage measuring circuit 10, capable of measuring the magnitude of an alternating current (AC) voltage source 12 that provides a sinusoidal voltage V_(IN), as for example depicted in FIG. 1. As illustrated in FIG. 1, source 12 provides a voltage V_(IN) that is sinusoidal having an amplitude V_(pk), at a frequency of 1/T_(f) (where T_(f) is the period of the sinusoid).

As illustrated in FIG. 2, voltage measuring circuit 10 includes a full wave bridge rectifier 18 that receives V_(IN) from source 12 and provides a full-wave rectified output V_(RECT), as depicted in FIG. 4A.

The output of rectifier 18 is provided to a voltage divider 20 and the output of rectifier 18 is further used to power downstream components, as detailed below.

Voltage divider 20 includes resistor R₃ 30 and resistor R₆ 32 that provide fractional voltage

$\frac{R_{6}}{R_{3} + R_{6}}.$

V_(RECT) to the input of a comparator 22.

Comparator 22 may be formed using a conventional operational amplifier 24 whose inverting input is driven by a reference source 36, that provides a reference DC voltage V_(i). The non-inverting input of operational amplifier 24 acts as the input to comparator 22 that receives the divided voltage

${V_{COMP} = {{\frac{R_{6}}{R_{3} + R_{6}} \cdot V_{RECT}} = {\frac{1}{K} \cdot V_{RECT}}}},{where}$ ${K = \frac{R_{3} + R_{6}}{R_{6}}},$

as depicted in FIG. 4B

As will be appreciated, the output of amplifier 24 acts as a comparator output that drives opto-isolator 28. The output of comparator 22 will be high any time V_(COMP)

$\left( {{i.e.\mspace{14mu} \frac{R_{6}}{R_{3} + R_{6}}} \cdot V_{RECT}} \right)$

equals or exceeds V₁, and low otherwise, as depicted in FIG. 4B. The resulting output of comparator 22 drives opto-isolator 28. The output of opto-isolator 28 will be a pulse-width modulated (PWM) square wave, of period T_(f), as depicted in FIG. 4C. The width u of the square wave (i.e. the time the output of comparator 22 is high) is dependent on the frequency and amplitude of V_(IN).

As such, the output of opto-isolator 28 may be provided to a calculation circuit 16 that may translate the width of the PWM square wave to a signal representative of the magnitude of AC voltage source 12, measured for example as a peak or RMS voltage, and optionally the frequency of V_(IN). As well, the absence of a square wave output voltage at opto-isolator 28 may be interpreted as low or no output voltage fault or condition.

Specifically, the output of operational amplifier 24 drives opto-isolator 28 through resistor 26. Now, by measuring the width u of the square wave, it is possible to determine V_(pk) and/or the RMS voltage (V_(RMS)) of source 12, and/or the frequency of V_(IN).

In particular, as illustrated in FIG. 4B, the input to comparator 22 may be expressed as:

$\begin{matrix} {V_{COMP} = {V_{i} = {\frac{V_{p\; k}}{K} \cdot {{\sin \left( {\omega \; t_{0}} \right)}}}}} & (1) \end{matrix}$

where t_(o) represents the time of intersection of V_(IN) and V_(i).

From this, V_(pk) may be determined:

$\begin{matrix} {V_{p\; k} = \frac{K \cdot V_{i}}{{\sin \left( {2\pi {\frac{1}{T_{f}} \cdot t_{0}}} \right)}}} & (2) \end{matrix}$

Expressed in terms of u, the width of the PWM square wave (i.e. the time it is on) depicted in FIG. 4C,

$\begin{matrix} {V_{p\; k} = {\frac{K \cdot V_{i}}{{\sin \left( {2{\pi \cdot \frac{1}{T_{f}} \cdot \frac{u}{2}}} \right)}} = \frac{K \cdot V_{i}}{{\sin \left( {\pi \cdot \frac{u}{T_{f}}} \right)}}}} & (3) \end{matrix}$

Noting that u may be interrelated to the period of V_(IN), T_(f), as:

T _(f)=2·(u+w)  (4)

where w represents the time the PWM square wave is off.

Substituting equation (4) into equation (3), yields:

$\begin{matrix} {V_{p\; k} = \frac{K \cdot V_{i}}{{\sin \left( {\pi \cdot \frac{u}{2 \cdot \left( {u + w} \right)}} \right)}}} & (5) \end{matrix}$

For a sine wave, the RMS voltage may be calculated from V_(pk) by observing,

$\begin{matrix} {V_{{RM}\; S} = {\frac{V_{p\; k}}{\sqrt{2}} = \frac{K \cdot {Vi}}{\sqrt{2} \cdot {{\sin \left( {\pi \cdot \frac{u}{2 \cdot \left( {u + w} \right)}} \right)}}}}} & (6) \end{matrix}$

The output of opto-isolator 28 may feed an input to a processing/calculation circuit 16. In one embodiment, calculation circuit 16 may take the form of a processor 42, in the form of a controller, microprocessor, digital signal processor (DSP) or the like, under program control, as depicted in FIG. 3A.

Processor 42 may sample the output of opto-isolator 28 to determine values of w and u. For example, the processor 16 may sample the output of opto-isolator 28 to calculate w and u. For example, processor 16 may calculate the magnitude of the voltage V_(pk) as

$\frac{K \cdot V_{i}}{\sin \left( {\pi \cdot \frac{u}{2 \cdot \left( {u + w} \right)}} \right)}$

or the RMS voltage V_(RMS) as

$\frac{K \cdot V_{i}}{\sqrt{2} \cdot {\sin \left( {\pi \cdot \frac{u}{2 \cdot \left( {u + w} \right)}} \right)}}.$

Typically, an average V_(RMS) value is of interest. The average may be determined as the sum of RMS values during n cycles divided by n.

That is, the average RMS voltage may be determined as:

$= {{\frac{1}{n} \cdot {\sum\limits_{i = 1}^{n}\; \frac{K \cdot V_{i}}{\sqrt{2} \cdot {\sin \left( {\pi \cdot \frac{u\lbrack i\rbrack}{2 \cdot \left( {{u\lbrack i\rbrack} + {w\lbrack i\rbrack}} \right)}} \right)}}}} = {\sum\limits_{i = 1}^{n}\; \frac{K \cdot V_{i}}{\sqrt{2} \cdot n \cdot {\sin \left( {\pi \cdot \frac{u\lbrack i\rbrack}{2 \cdot \left( {{u\lbrack i\rbrack} + {w\lbrack i\rbrack}} \right)}} \right)}}}}$

Circuit 14 may perform the calculation above. For convenience, V_(i) may be arbitrarily chosen based on the operating voltage of amplifier 24. V_(i) is typically chosen as less than the operating voltage. In the depicted embodiment, V_(i) may be chosen as 1.24V, which is a typical reference voltage. Now, K will need to be chosen based on the minimum voltage to be measured. That is, KV_(i) should be chosen to be less than or equal to the minimum voltage to be measured. If, for example, the lowest V_(RMS) to be measured V_(RMS) _(—) _(min)=57 V (corresponding to a lowest contemplated V_(RMS) of 57 V), K may be chosen as V_(RMS) _(—) _(min)/V_(i)=57/1.24=45.9677.

Additionally or alternatively, the calculation may be simplified to reduce the number of multiplications and divisions performed. This may, for example, be done by choosing a specific number of samples (n), based on the chosen values of V_(i) and K, and adjusting K as required. That is, for any particular chosen V_(i), n may be chosen as an integer approximation of K/√2. This simplification helps when calculating the RMS averaging. If a proper n and K are chosen, the averaging operation may be reduced to a summing operation instead of summing and division. However, this is only to decreases the required computational power.

That is, for the example minimum detection of V_(RMS) of 57V, and V_(i) chosen as 1.24 V, and K=45.9677, a choice of n around 32.5 would reduce multiplication/division. This choice of n and K eliminates the need to multiply and divide. The number of samples (represented by the integer value of “n”) determines how many samples must be added together to produce an average value of the input RMS voltage

However, as n represents the number of samples, n must be an integer. Thus n may be chosen as n=32 (related to averaging of 32 samples). K may in turn be adjusted/chosen to be K=√{square root over (2)}·32=45.2548. Put another way, to simplify division and multiplication, choice of K and n may be made such that the ration of K/√(2·n) equals one (1) or some other integer.

In turn, R₃ and R₆ may be chosen as

${\frac{R_{3} + R_{6}}{R_{6}} = 45.2548},$

using standard available resistor values.

Continuous sampling over multiple cycles may be averaged to determine the average RMS voltage.

Conveniently, processing/calculation circuit 16 may further determine AC frequency, and/or a fault condition. For example, processing/calculation circuit 16 may monitor the output of opto-isolator 28 for each cycle to assess a fault. For example, if the output remains in high impedance (or logic high, if biased) for half of an AC cycle (i.e. no square wave output), a fault may be sensed, and optionally signalled. Likewise the AC frequency of V_(IN) may be sensed as

${{frequ}.} = {\frac{1}{2 \cdot \left( {u + w} \right)}.}$

Processor 42 may provide separate digital outputs V_(out), FREQU_OUT, FAULT_OUT, indicative of measured voltage, frequency or generate a fault flag.

Rectifier 18 (FIG. 2) may further provide the operating current/voltage to comparator 22, and opto-isolator 28. As such, in the depicted embodiment circuit 10 components on the input side of opto-isolator 28 do not need to share a power supply with processing/calculation circuit 16.

Circuit 14 may be formed using discrete or integrated components, or possibly using one or more microcontrollers, digital signal processors (DSPs), or a combination thereof.

FIG. 5 illustrates an example circuit 14 formed using four diodes arranged as bridge rectifier 18. Voltage divider 20 is formed from resistors R₃ and R6. Comparator 22 (including a reference source) may be formed using from two resistors R4, R5 and a controllable Zener diode U2. A depletion mode MOSFET Q1, the resistor R1, the capacitor C1 and fixed value zener diode D2, bias the comparator 22 and opto-isolator 28. Opto-isolator 28 may be a standard opto-coupler such as 4N31 or 4N32 six pin packaged opto-coupler. Q1 and R1 form a constant current source that charges C1 which supplies energy around the input voltage zero crossing, when diodes of rectifier 18 do not provide supply current. D2 limits the bias voltage across the comparator, U2 (the controllable zener diode U2 is used as comparator). The resistor R4 is used to bias U2 and R5 to limit the current through the LED of opto-coupler 28.

Conveniently, the circuit of FIG. 5 uses relatively few components and may be produced at a low cost. It further provides for isolation between the power supply used to provide power to controller 16, and the voltage being measured. Moreover, the output of circuit 14 may easily feed controller 16 or another DSP or processor, using, for example a general purpose I/O (GPIO) pin.

In an alternative embodiment, processing/calculation circuit 16 may take the form of an integrator as depicted in FIG. 3B. In particular, the ratio u/(u+w) represents the duty cycle of the output signal of opto-isolator 28, with a fixed frequency 1/(u+w). As such, the output of opto-isolator 28 may be integrated to form a signal proportional to the AC input voltage. A suitable integrator may be formed using a conventional operational amplifier 38, a capacitor 34 and a resistor 32. A further resistor 31 may bias the output of opto-isolator 28. The integrator may integrate the waveform of FIG. 4C over multiple cycles, and thereby present an average analog voltage signal proportional to u. Proper choice of values for capacitor 34 and resistor 32 allow amplifier 38 to output a bounded voltage proportional to V_(pk) and V_(RMS)

Of course, the above described embodiments are intended to be illustrative only and in no way limiting. The described embodiments of carrying out the invention are susceptible to many modifications of form, arrangement of parts, details and order of operation. The invention, rather, is intended to encompass all such modification within its scope, as defined by the claims. 

What is claimed is:
 1. A voltage measuring circuit, comprising: a rectifier to receive an alternating current (AC) voltage to be measured and to provide a rectified output; a comparator for comparing said rectified output and producing therefrom a square wave having a pulse width indicative of said rectified output exceeding a threshold; a calculation circuit for converting a measurement of said pulse width into a measurement of said voltage.
 2. The circuit of claim 1, further comprising an opto-isolator interconnecting said comparator to said calculation circuit.
 3. The circuit of claim 1, wherein said calculation circuit comprises an integrator.
 4. The circuit of claim 1, wherein said calculation circuit comprises a processor for sampling said square wave to determine at least one of said pulse width, and frequency of said square wave.
 5. The circuit of claim 4, wherein said processor is operable to calculate a frequency of said AC voltage from at least one of said pulse width and said frequency of said square wave.
 6. The circuit of claim 4, wherein u is the time said square wave is high, and w is the time said square wave is low in a period, and wherein said processor calculates said frequency as $\frac{1}{2 \cdot \left( {u + w} \right)}.$
 7. The circuit of claim 4, wherein said threshold equals K·V_(i) and wherein u is the time said square wave is high, and w is the time said square wave is low in a period, and wherein said processor calculates said measurement of said voltage as $\frac{K \cdot V_{i}}{\sin \left( {\pi \cdot \frac{u}{2 \cdot \left( {u + w} \right)}} \right)}.$
 8. The circuit of claim 4, wherein said threshold equals KV_(i) and wherein u is the time said square wave is high, and w is the time said square wave is low in a period, and wherein said processor calculates said measurement of said voltage as $\frac{K \cdot V_{i}}{\sqrt{2} \cdot {\sin \left( {\pi \cdot \frac{u}{2 \cdot \left( {u + w} \right)}} \right)}}.$
 9. The circuit of claim 4, wherein said threshold equals KV_(i) and wherein u[i] is the time said square wave is low, and w[i] is the time said square wave is high in a period, and wherein said processor calculates said measurement of said voltage as $\sum\limits_{i = 1}^{n}\; {\frac{K \cdot V_{i}}{\sqrt{2} \cdot n \cdot {\sin \left( {\pi \cdot \frac{u\lbrack i\rbrack}{2 \cdot \left( {{u\lbrack i\rbrack} + {w\lbrack i\rbrack}} \right)}} \right)}}.}$
 10. The circuit of claim 9, wherein K and n are chosen so that the ratio K/√2·n) approximates an integer.
 11. The circuit of claim 1, wherein said processor signals a fault when no square wave is output by said comparator.
 12. The circuit of claim 2, wherein said rectifier provides operating power to said comparator and an input side of said opto-isolator, from said AC voltage being measured.
 13. A method of measuring the magnitude of an AC voltage signal, said method comprising: rectifying said AC voltage signal to provide a rectified output; comparing said rectified output and producing therefrom a square wave having a pulse width indicative of said rectified output exceeding a threshold; converting a measurement of said pulse width into a measurement of said magnitude of said AC voltage signal.
 14. The method of claim 13, wherein said converting comprises integrating said square wave.
 15. The method of claim 13, wherein said converting comprises sampling said square wave to determine a time that said square wave is on and a time that said square wave is off.
 16. The method of claim 15, wherein said threshold equals K·V_(i) and wherein u is the time said square wave is high, and w is the time said square wave is low in a period, and wherein said measurement said voltage is calculated as $\frac{K \cdot V_{i}}{\sin \left( {\pi \cdot \frac{u}{2 \cdot \left( {u + w} \right)}} \right)}.$
 17. The method of claim 16, wherein said threshold equals K·V_(i) and wherein u is the time said square wave is high, and w is the time said square wave is low in a period, and wherein said voltage is calculated as $\frac{K \cdot V_{i}}{\sqrt{2} \cdot {\sin \left( {\pi \frac{u}{2 \cdot \left( {u + w} \right)}} \right)}}.$
 18. The method of claim 15, wherein said threshold equals K·V_(i) and wherein u[i] is the time said square wave is low, and w[i] is the time said square wave is high in a period of said AC voltage, and wherein said measurement of said voltage is calculated over n periods as $\sum\limits_{i = 1}^{n}\; {\frac{K \cdot V_{i}}{\sqrt{2} \cdot n \cdot {\sin \left( {\pi \cdot \frac{u\lbrack i\rbrack}{2 \cdot \left( {{u\lbrack i\rbrack} + {w\lbrack i\rbrack}} \right)}} \right)}}.}$
 19. The method of claim 18, wherein K and n are chosen so that K/(√2·n) approximates an integer. 